import axios from '@/utils/request';
const baseOriginURL = process.env.VUE_APP_BASE_ORIGIN + '/iot_maintenance';

//获取工程师列表
const getOrderListByEngineer = data => {
  return axios.get(baseOriginURL + '/maintenance/getOrderListByEngineer', {
    params: data
  });
};
//工单详情
const getOrderDetails = data => {
  return axios.get(baseOriginURL + '/maintenance/getOrderDetails',{
    params: data
  });
};
//接单
const receiveOrder = data => {
  return axios.post(baseOriginURL + '/maintenance/receiveOrder', data);
};


//获取工单管理列表
const getOrderList = data => {
  return axios.get(baseOriginURL + '/maintenance/getOrderList',{
    params: data
  });
};
//删除工单
const DeleteOrder = data => {
  return axios.delete(baseOriginURL + '/maintenance/deleteOrder', data);
};
//取消工单
const cancelOrder = data => {
  return axios.post(baseOriginURL + '/maintenance/cancelOrder', data);
};
//派单
const dispatchOrder = data => {
  return axios.post(baseOriginURL + '/maintenance/dispatchOrder', data);
};
//工单修改
const updateOrder = data => {
  return axios.post(baseOriginURL + '/maintenance/updateOrder', data);
};
//上传文件
const uploadFile = data => {
  return axios.post(process.env.VUE_APP_BASE_ORIGIN + '/iot_common' + '/uploadFile', data);
};
//获取用户
const getSystemUserList = data => {
  return axios.get(process.env.VUE_APP_BASE_ORIGIN + '/iot_user' + '/user/getSystemUserList', data);
};
//获取工程师列表
const getEngineerList = data => {
  return axios.get(baseOriginURL + '/maintenance/getEngineerList');
};
//获取物模型配件
const getModelAccessories = data => {
  return axios.get(process.env.VUE_APP_BASE_ORIGIN + '/iot_device' + '/device/getModelAccessories', {
      params: data
  });
};
//处理工单
const completeOrder = data => {
  return axios.post(baseOriginURL + '/maintenance/completeOrder', data);
};
//获取保养计划列表
const getPlanList = data => {
  return axios.get(baseOriginURL + '/maintenance/getPlanList',{
    params: data
  });
};

export {
  getOrderListByEngineer,
  getOrderDetails,
  receiveOrder,
  getOrderList,
  DeleteOrder,
  cancelOrder,
  dispatchOrder,
  updateOrder,
  uploadFile,
  getSystemUserList,
  getEngineerList,
  getModelAccessories,
  completeOrder,
  getPlanList
};
